#include "BasicLayer.h"


BasicLayer::BasicLayer(void)
{
}


BasicLayer::~BasicLayer(void)
{
}


bool BasicLayer::init()
{
	bool bret = false;
	do 
	{
		CC_BREAK_IF(!CCLayer::init());

		bret= true;
	} while (0);
	return bret;
}

CCSize BasicLayer::getLayerSize()
{
	return CCDirector::sharedDirector()->getWinSize();
}




void BasicLayer::setBackGround (const char* backimagename)
{
	CCSprite* pSprite = CCSprite::create(backimagename);
	pSprite->setPosition(ccp(getLayerSize().width/2,getLayerSize().height/2));
	this->addChild(pSprite,-1);
	

}

void BasicLayer::addButton(char* nor,char* pre,char* dis, SEL_MenuHandler selector,CCPoint positon,CCNode* parent_node)
{
	
	CCSprite* pNormal = CCSprite::create(nor);
	CCSprite* pPressed = CCSprite::create(pre);
	CCSprite* pDisabled = CCSprite::create(dis);
	CCMenuItemSprite* pMenuItem = CCMenuItemSprite::create(pNormal,pPressed,pDisabled,this,selector);
	CCMenu* pMenu = CCMenu::create(pMenuItem,NULL);

	CCSize msize = pNormal->getContentSize();
	pMenu->setPosition(positon);
	parent_node->addChild(pMenu);
};
